<?php foreach ($messages["Message"] as $message): ?>
    <div id="entry">
        <div id="photo_profile">
            <a href="<?php echo BASE_PATH; ?>/users/view/<?php echo $message["Message"]["author_user_id"] ?>" >
                <img src="<?php echo BASE_PATH; ?>/photos/thumbs/<?php echo $message["Photo"]["filename"] ?>" alt=""/>
            </a>
        </div>
    <?php if ($message['Replie']['isread'] == 1) {
 ?>
        <div id="read">
            <a href="<?php echo BASE_PATH; ?>/messages/view/<?php echo $this->session->get("user_id") ?>/<?php echo $message["Conversation"]["id"] ?>" >
<?php echo $message["Conversation"]["subject"]; ?>
        </a>
    </div>
<?php } else { ?>
            <div id="unread">
                <a href="<?php echo BASE_PATH; ?>/messages/view/<?php echo $this->session->get("user_id") ?>/<?php echo $message["Conversation"]["id"] ?>" >
<?php echo $message["Conversation"]["subject"]; ?>
        </a>
    </div>
<?php } ?>
        <div id="sender">
            Originally From :
        <?php
        if ($message["User"]["id"] == $this->session->get('user_id'))
            echo "You";
        else
            echo $message["User"]["name"];
        ?>
    </div>
    <div id="show_recipient">
        Between :
        <?php
        foreach ($messages['Recipient'] as $participant):
            if (($participant["Participant"]["user_id"] != $this->session->get('user_id')) && ($message['Conversation']['id'] == $participant["Participant"]["conversation_id"])):
                echo $participant["User"]["name"] . ", ";
            endif;
        endforeach;
        echo "and You";
        ?>
    </div>
    <div id="delete">
        <a href="<?php echo BASE_PATH; ?>/messages/delete/<?php echo $message["Conversation"]["id"] ?>/<?php echo $this->session->get("user_id") ?>" >
            (delete)
        </a>
    </div>
    <div class="clear"></div>
</div>
<?php endforeach ?>